<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix = "c"  uri = "http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML>
<html lang="en-US">
<head>

	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
	<title>凯胜项目管理系统</title>
	<style type="text/css">
		body{
			padding-top:70px;
		}
	</style>
 </head>
  <body>
   	<%@include file="same2.jsp" %>
	<div class="container">
		<div class="row">
			<%@include file="same.jsp" %>
			<div class="span9">
				<div class="clear"></div>
				 <ul class="breadcrumb" style="margin-bottom:0px;border-radius: 3px 3px 0 0;margin-top:20px">
					<li class="active">
						<i class="icon-th"></i>${requestScope.GoalProgress.goal.gname }
					</li>
				</ul>
				<div class="wall" style="border-top:none; border:1px solid #dddddd ">
					<p style="margin:15px">${requestScope.GoalProgress.goal.gdescription }</p>
					<div class=" progress progress-danger" style="width:90%;color:red; margin-left:20px">
						<div class="bar" style="width: ${requestScope.GoalProgress.progress}%;color:white;text-align:center">总进度已完成${requestScope.GoalProgress.progress}%</div>
					</div>
					<c:choose>
						<c:when test="${sessionScope.userProject.role=='manager'}">
							<div style="margin-left:20px;margin-top:15px"><a class="btn btn-success" href="task.jspx?tmothed=add&id=${requestScope.GoalProgress.goal.id}"><i class="icon-plus  icon-white"></i>添加新任务</a></div>
						</c:when>
						<c:otherwise>
						
						</c:otherwise>
					</c:choose>
					<hr>
					<c:choose>
						<c:when test="${empty requestScope.userTasklist}">
							<div>
								<div style="margin-left:20px">该目标还没有创建任务</div>
							</div>
						</c:when>
						<c:otherwise>
							<c:forEach items = "${requestScope.userTasklist}" var = "usertask">
							<input id="progress" type="hidden" name="progress" value="${usertask.task.progress}">
							<div>
								<c:choose>
									<c:when test="${usertask.task.progress==-1}">
										<div  class="breadcrumb"  style="margin:10px;height:15px"><i class="icon-bookmark"></i>${usertask.task.name}[${usertask.user.username}]<span style="margin-left:20px">截止时间：${usertask.task.endtime}</span>
											<c:choose>
												<c:when test="${sessionScope.userProject.role=='manager'}">
													<span style="float:right"><a href="task.jspx?tmothed=deltask&id=${usertask.task.id}&goalid=${requestScope.GoalProgress.goal.id}"><i class="icon-trash"></i>删除</a></span>
												</c:when>
												<c:otherwise>
												
												</c:otherwise>
											</c:choose>
											
										</div>
										<p style="margin:2px  ; margin-left:20px">${usertask.task.description}</p>
										<div id="mytask" style="margin:15px;color:red;text-align:center">
											该任务已经过期
										</div>
									</c:when>
									<c:when test="${usertask.task.progress==101}" >
										<div  class="breadcrumb"  style="margin:10px;height:15px"><i class="icon-bookmark"></i>${usertask.task.name}[${usertask.user.username}]<span style="margin-left:20px">开始时间：${usertask.task.starttime}</span></div>
										<p style="margin:2px  ; margin-left:20px">${usertask.task.description}</p>
										<div id="mytask" style="margin:15px;color:red;text-align:center">
											该任务未到开始日期
										</div>
									</c:when>
									<c:otherwise >
										<div  class="breadcrumb"  style="margin:10px;height:15px"><a href="task.jspx?tmothed=edit&id=${usertask.task.id}&goalid=${requestScope.GoalProgress.goal.id}"><i class="icon-bookmark"></i>${usertask.task.name}</a>[${usertask.user.username}]<span style="margin-left:20px">开始时间：${usertask.task.starttime}</span><span style="margin-left:20px">截止时间：${usertask.task.endtime}</span>
											<c:choose>
												<c:when test="${sessionScope.userProject.role=='manager'}">
													<span style="float:right"><a href="task.jspx?tmothed=edit&id=${usertask.task.id}&goalid=${requestScope.GoalProgress.goal.id}"><i class="icon-pencil"></i>编辑</a></span>
												</c:when>
												<c:when test="${sessionScope.userProject.user.username==usertask.user.username}">
													<span style="float:right"><a href="task.jspx?tmothed=edit&id=${usertask.task.id}&goalid=${requestScope.GoalProgress.goal.id}"><i class="icon-pencil"></i>编辑</a></span>
												</c:when>
												<c:otherwise>
												
												</c:otherwise>
											</c:choose>
										</div>
										<p style="margin:2px  ; margin-left:20px">${usertask.task.description}</p>
										<c:choose>
											<c:when test="${usertask.task.stat=='新任务'}">
												<div id="myprogress" style="margin:10px">
													<div class="progress progress-success" style="width:90%;color:red; margin-left:20px">
													<div class="bar" style="width: 0%;color:white;text-align:center">0%</div>
													</div>
												</div>
											</c:when>
											<c:when test="${usertask.task.stat=='已完成'}">
												<div id="myprogress" style="margin:10px">
													<div class="progress progress-success" style="width:90%;color:red; margin-left:20px">
													<div class="bar" style="width: 100%;color:white;text-align:center">100%</div>
													</div>
												</div>
											</c:when>
											<c:otherwise>
												<div id="myprogress" style="margin:10px">
													<div class="progress" style="width:90%;color:red; margin-left:20px">
													<div class="bar" style="width: ${usertask.task.progress}%;color:white;text-align:center">${usertask.task.progress}%</div>
													</div>
												</div>
											</c:otherwise>
										</c:choose>
									</c:otherwise>
								</c:choose>
							</div>
							</c:forEach>
						</c:otherwise>
					</c:choose>
			</div>
		</div>
	</div>
</div>	
<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			$("#myid li").eq(3).addClass("active");
			$("#myid i").eq(1).addClass("  icon-white");
			/*var r=$("#progress").attr("val");
			if(r.equals("0")){
				$("#myprogress").hidden();
			}else{
				$("#myprogress >div:eq(1)").css("width","r%");
			}*/
		});
		
	</script>	
  </body>
</html>
